package com.city.repository.pub;

import com.city.domain.pub.PubProvince;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @deprecation: 国家省份信息
 * @dmail: 398521613@qq.com
 * @author: L-H
 * @date: 2018-07-18 13:14
 */
@Repository
public interface PubProvinceRepository extends JpaRepository<PubProvince,Integer> {

    @Query(value = "select * from pub_province", nativeQuery=true)
    List<PubProvince> getAll();

    /**
     * @Author: 李顺时
     * @Description: 通过省份代号查找对应省份名字
     * @Date: 16:17 2018/8/12
     */
    @Query(value = "select name from pub_province where code=?1", nativeQuery=true)
    String getNameByCode(String code);

}
